﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;

namespace Hopscotch.Presentation.Common.Converters
{
	/// <summary>
	/// This converter does nothing except breaking the
	/// debugger into the convert method
	/// </summary>
	/// <remarks>http://wpftutorial.net/DebugDataBinding.html</remarks>
	public class DatabindingDebugConverter : MarkupExtension, IValueConverter
	{
		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return this;
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			Debugger.Break();

			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			Debugger.Break();

			return value;
		}
	}

}
